<template>
  <div class="index-container">
    <!-- 欢迎区域 -->
    <section class="hero-section">
      <h1>欢迎来到智慧养老服务平台</h1>
      <p class="welcome-text">尊老敬老，智慧养老，让关爱无处不在</p>
    </section>

    <!-- 核心功能介绍 -->
    <section class="features-section">
      <h2 class="section-title">核心功能</h2>
      <div class="feature-grid">
        <div class="feature-card">
          <div class="feature-icon"><i class="el-icon-monitor"></i></div>
          <h3>健康监测</h3>
          <p>实时监测老人健康状况，异常情况及时预警</p>
        </div>

        <div class="feature-card">
          <div class="feature-icon"><i class="el-icon-bell"></i></div>
          <h3>紧急呼叫</h3>
          <p>一键紧急呼叫，快速响应老人需求</p>
        </div>

        <div class="feature-card">
          <div class="feature-icon"><i class="el-icon-date"></i></div>
          <h3>服务预约</h3>
          <p>便捷预约各类养老服务，满足个性化需求</p>
        </div>
      </div>
    </section>

    <!-- 快速操作 -->
    <section class="quick-actions">
      <h2 class="section-title">快速开始</h2>
      <div class="action-buttons">
        <el-button type="primary" icon="el-icon-plus" @click="goToService">预约服务</el-button>
        <el-button type="success" icon="el-icon-user" @click="goToProfile">查看个人资料</el-button>
        <el-button type="info" icon="el-icon-setting" @click="goToSettings">系统设置</el-button>
      </div>
    </section>

    <!-- 近期活动 -->
    <section class="activity-section">
      <h2 class="section-title">近期活动</h2>
      <el-carousel height="200px" indicator-position="outside">
        <el-carousel-item v-for="item in activities" :key="item.id">
          <div class="activity-card">
            <h3>{{ item.title }}</h3>
            <p>{{ item.description }}</p>
            <el-button type="text">查看详情</el-button>
          </div>
        </el-carousel-item>
      </el-carousel>
    </section>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';

const router = useRouter();

// 模拟活动数据
const activities = ref([
  { id: 1, title: '社区健康讲座', description: '邀请专家讲解老年人健康管理知识' },
  { id: 2, title: '志愿者招募', description: '加入我们的志愿者团队，为社区老人服务' },
  { id: 3, title: '智能设备体验', description: '免费体验最新智能养老设备' },
  { id: 4, title: '端午节活动', description: '包粽子、送温暖，共度端午佳节' },
]);

// 页面跳转方法
const goToService = () => router.push('/services');
const goToProfile = () => router.push('/profile');
const goToSettings = () => router.push('/settings');
</script>

<style scoped>
.index-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
  font-family: "Helvetica Neue", sans-serif;
}

/* 欢迎区域 */
.hero-section {
  text-align: center;
  padding: 80px 20px 60px;
  background: white;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.hero-section h1 {
  font-size: 2.5rem;
  color: #333;
  margin-bottom: 15px;
}

.welcome-text {
  font-size: 1.2rem;
  color: #666;
  max-width: 600px;
  margin: 0 auto 40px;
}

/* 功能模块 */
.features-section,
.quick-actions,
.activity-section {
  max-width: 1200px;
  margin: 60px auto;
  padding: 40px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.section-title {
  text-align: center;
  font-size: 1.8rem;
  color: #333;
  margin-bottom: 30px;
}

.feature-grid {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.feature-card {
  flex: 1;
  min-width: 280px;
  background: #fff;
  border-radius: 12px;
  padding: 30px;
  margin: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  text-align: center;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.feature-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #409eff 0%, #64b5f6 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.feature-icon i {
  font-size: 40px;
}

.feature-card h3 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  color: #333;
}

.feature-card p {
  color: #666;
  line-height: 1.6;
}

/* 快速操作按钮 */
.action-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.action-buttons .el-button {
  padding: 15px 30px;
  font-size: 1.1rem;
  border-radius: 8px;
  min-width: 160px;
}

/* 活动卡片 */
.activity-card {
  background: linear-gradient(135deg, #f0f7ff 0%, #e3f2fd 100%);
  border-radius: 12px;
  padding: 30px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.activity-card h3 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  color: #1e88e5;
}

.activity-card p {
  color: #546e7a;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* 响应式设计 */
@media (max-width: 992px) {
  .feature-grid {
    flex-direction: column;
    align-items: center;
  }

  .feature-card {
    width: 100%;
    max-width: 500px;
  }

  .action-buttons {
    flex-direction: column;
    align-items: center;
  }

  .action-buttons .el-button {
    width: 100%;
    max-width: 300px;
    margin-bottom: 10px;
  }
}
</style>
